package com.jht.pj.sys.controller;

import com.jht.pj.common.pojo.JsonResult;
import com.jht.pj.sys.pojo.Song;
import com.jht.pj.sys.service.SingerSongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/singersong/")
public class SingerSongController {

    @Autowired
    private SingerSongService singerSongService;
    //http://localhost/singersong/findAll
    @RequestMapping("findAll")
    public JsonResult findAll(String name){
        return new JsonResult(singerSongService.findAll(name));
    }
    //http://localhost/singersong/doSaveSong
    @RequestMapping("doSaveSong")
    public JsonResult doSaveSong(Song entity, String singerName){
        singerSongService.saveSong(entity, singerName);
        return new JsonResult("save ok");
    }
}
